<?php
include_once($_SERVER["DOCUMENT_ROOT"]."/bolsa_trabajo/util/database.php");
class EmailDistributionList 
{
	private static $dbName = 'bolsa_trabajo' ; 
	private static $dbHost = 'localhost' ;
	private static $dbUsername = 'admin';
	private static $dbUserPassword = 'Pa$$w0rd';
	
	private static $cont  = null;
	
	public function __construct() {
		exit('Init function is not allowed');
	}
	
	public static function getEmailAdministradores(){
		$pdo = Database::connect();
		$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
		$sql = "SELECT email FROM tbl_administrador where estado = 'activo'";
		$q = $pdo->prepare($sql);
		$q->execute();
		
		$num = $q->rowCount();
		
		$emailsArray = array();
		if($num>0){
			while ($row = $q->fetch(PDO::FETCH_ASSOC)){
				extract($row);
				
				array_push($emailsArray,$email);
				
			}
		}
		
		
		return $emailsArray;
	
	}
	
	
	
}
?>